import request from '@/utils/request'

const api_name = '/teach/course';
export default {

  //保存课程基本信息
  saveCourseInfo(courseInfo) {
    return request({
      url: `${api_name}/saveCourseInfo`,
      method: 'post',
      data: courseInfo
    })
  },

  //根据课程id获取课程基本信息
  getCourseByCourseId(courseId) {
    return request({
      url: `${api_name}/getCourseInfoById/${courseId}`,
      method: 'get',
    })
  },

  //修改课程基本信息
  updateCourse(courseInfo) {
    return request({
      url: `${api_name}/updateCourse/${courseInfo.id}`,
      method: 'put',
      data: courseInfo
    })
  },

  //根据课程id查询课程确认信息
  getCoursePublish(courseId) {
    return request({
      url: `${api_name}/getCoursePublish/${courseId}`,
      method: 'get',
    })
  },

  //发布课程
  publishCourse(courseId) {
    return request({
      url: `${api_name}/publishCourse/${courseId}`,
      method: 'put',
    })
  },

  //条件查询带分页
  pageCourse(current, limit, searchObj) {
    return request({
      url: `${api_name}/pageCourseList/${current}/${limit}`,
      method: 'post',
      data: searchObj
    })
  },

  //删除课程
  removeCourse(courseId) {
    return request({
      url: `${api_name}/removeCourse/${courseId}`,
      method: 'delete'
    })
  }

}
